#include "win32GLWindow.h"
#include "win32GLContext.h"
#include "win32WindowImpl.h"

#include <iostream>

using namespace std;

using namespace neiderra::core;
using namespace neiderra::gui;

win32GLWindow::win32GLWindow(Core* core, const std::string& title): GUIWindow(core) {
	win32WindowImpl* impl =
        new win32WindowImpl(
            core,
            this,
            title,
            new win32WndClass("standard", (WNDPROC) win32WindowImpl::MsgRouter));

	impl_ = impl;
	glc_ = new win32GLContext();
	glc_->init(impl->getHWND());
}

win32GLWindow::win32GLWindow(Core* core,
    const std::string& title,
    int x, int y, int width, int height,
    GUIWindow* parent ): GUIWindow(core)
{
    title_ = title;

    win32WindowImpl* impl =
        new win32WindowImpl(
            core,
            this,
            title,
            new win32WndClass("standard", (WNDPROC) win32WindowImpl::MsgRouter),
            x, y, width, height,
            parent);

    impl_ = impl;
    glc_ = new win32GLContext();
    glc_->init(impl->getHWND());
//    core->getLogger()->log("Window dimentions:");
}

void win32GLWindow::show()
{
	impl_->show();
}

void win32GLWindow::update()
{
	impl_->update();
}

win32GLWindow::~win32GLWindow(){
	delete glc_;
	delete impl_;
}

